/****************************************************
          File Name:capture_encode.h
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Mon 17 Nov 2014 08:57:30 AM CST
*****************************************************/


#ifndef			capture_encode_h_
#define			capture_encode_h_

#include <assert.h>
#include <string.h>
#include <syslog.h>
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <x264.h>

typedef struct encode {
	int h264_fd;
	int count;
	uint8_t *yuv422_frame;
	uint8_t *yuv420_frame;
	int nnal;
	x264_param_t *param;
	x264_nal_t *nals;
	x264_nal_t *nal;
	x264_t *encoder;
	x264_picture_t pic_out;
	x264_picture_t *pic_in;
} Encoder;

void value_init(Encoder *value);

void dev_open(void);

void dev_close(void);

void dev_init(void);

void start_capture(void);

void stop_capture(void);

int frame_read(Encoder *value);

void capture_process(Encoder *value);

void dev_uninit(void);

#endif

